/**
 * Created by pankaj on 25/10/14.
 */
define(['jquery'], function($){

    var form = function(){
        var validate = function(){
            var flatNo = $(".js_signupsuccess .js_flat").val();
            var phone = $(".js_signupsuccess .js_phone").val();
            if(flatNo.length == 0){
                $(".js_signupsuccess .js_flaterror").css('display', 'block');
                return false;
            } else {
                $(".js_signupsuccess .js_flaterror").css('display', 'none');
            }

            if(phone.length == 0){
                $(".js_signupsuccess .js_phoneerror").css('display', 'block');
                return false;
            } else {
                $(".js_signupsuccess .js_phoneerror").css('display', 'none');
            }
            return true;
        };

        // bind click event.
        $(".js_signupsuccess #btn-login").click(function(event){
            if (validate()) {
                // submit the form.
                $(".js_signupsuccess").submit();
            }
            event.preventDefault();
        });
    };
    return form;
});